package WaiBao;

import java.util.Arrays;

public class WangBiYu {
    public static void main(String[] args) {
        String[] name = {"吴振兴(班长)", "吴昊(团支书)", "小李", "李亚伟(体育委员)", "卢本伟", "杨培芳", "程咬金", "沙参", "汤森", "孙悟空", "妖怪", "刘备",
                "关于", "张飞", "邢道荣", "袁绍", "诸葛亮", "诸葛瑾", "孙权", "孙策", "鲁肃", "周瑜", "吕蒙", "张合", "吕布", "夏洛特", "蒙恬", "廉颇",
                "西施", "王碧玉(学习委员)"};//最后一位考生本人: 王碧玉(学习委员)
        int[] Age = {20, 19, 18, 21, 20, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁

        double[] date1 = {98, 87, 99, 80, 71, 69, 74, 89, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] date2 = {98, 95, 79, 66, 81, 97, 81, 76, 91, 75, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 94};
        double[] date3 = {78, 96, 90, 83, 71, 67, 75, 79, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 95};


        double elder;//代表每个学生的总分
        double baobbo;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            elder = date1[i] + date2[i] +date3[i];
//            baobbo = (  elder * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +  elder);
//            System.out.println(name[i] + "的平均分为:" + baobbo);
//        }


        double brazi = 0, azala = 0;
        double[] cam = new double[30];
//        for (int i = 0; i < 30; i++) {
//            brazi   = date1[i] +  date2[i] + date3[i];
//            azala= (brazi   * 1.0) / 3;
//            cam[i] =azala;
//        }
//
//        for (int i = 0; i < cam.length - 1; i++) {
//            for (int j = 0; j < cam.length - i - 1; j++) {
//                if (cam[j] < cam[j + 1]) {
//                    double tep = cam[j];
//                    cam[j] =cam[j + 1];
//                    cam[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(cam[i]);
//        }


        double cact1 = 0,cact2 = 0,cact3 = 0;//计算每门课的平均分
        double dasiy1 = 0,dasiy2 = 0, dasiy3 = 0;//计算每门课标准差
        double cat1 = 0, cat2 = 0, cat3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < date1.length; i++) {
            sum2+=date1[i];
        }
        cact1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+cact1);
        double Sum = 0;
        for (int i = 0; i < date2.length; i++) {
            Sum+=date2[i];
        }
        cact2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+cact2);
        double sum = 0;
        for (int i = 0; i <date3.length; i++) {
            sum+=date3[i];
        }
        cact3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+cact3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <date1.length; i++) {
            c1+= (date1[i] -cact1)*(date1[i] - cact1);
        }
        dasiy1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+dasiy1);

        for (int i = 0; i < date2.length; i++) {
            c2+= (date2[i] - cact2)*(date2[i] - cact2);
        }
        dasiy2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+dasiy2);

        for (int i = 0; i < date3.length; i++) {
            c3+= (date3[i] -cact3)*(date3[i] - cact3);
        }
        dasiy3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+dasiy3);
////
//////
//        Arrays.sort(date1);
//        Arrays.sort(date2);
//        Arrays.sort(date3);
//        cat1 =( date1[14]+date1[15])*1.0/2;
//        cat2 =( date2[14]+date2[15])*1.0/2;
//        cat3 =( date3[14]+date3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+cat1);
//        System.out.println("微生物学的中位数为:"+cat2);
//        System.out.println("人体组织解剖学的中位数为:"+cat3);


    }
}
